package com.example.springshell;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.shell.command.annotation.EnableCommand;
import org.springframework.shell.standard.ShellComponent;
import org.springframework.shell.standard.ShellMethod;

@SpringBootApplication
public class SpringShellApplication {

    public static void main(String[] args) {
        SpringApplication.run(SpringShellApplication.class, args);
    }

    @ShellComponent
    public class Commands {

        @ShellMethod(key = "greeting", value = "Display a greeting")
        public String greeting() {
            return "Hello, welcome to Spring Shell!";
        }

        @ShellMethod(key = "date", value = "Display the current date")
        public String currentDate() {
            return "The current date is: " + java.time.LocalDate.now();
        }
    }

}
